<extend name="Layout/back" />

<block name="content">
    <form action="{:U('add')}"  method="post">
    <div class="row" id="main" style="margin-left: 250px; margin-top: 50px;">
        <div class="form-group">
            <label for="title" style="" class=" col-md-2 col-md-push-1">文章标题</label>
            <div class="col-md-9 ">
            <input class="form-control" name="title" placeholder="文章标题" id="title">
            </div>
        </div>
        <div class="form-group">
                <label for="file" class="col-sm-2 control-label col-md-push-1">封面</label>

            <div class="col-sm-10">
                <input id="file" type="file" multiple="true" name="cover">
                <span>类型: *.jpg,*.png 大小: 2000KB 数量: 10</span>
                <div class="article_thumb"></div>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-2 col-md-push-1">
                <label for="summary">摘要</label>
            </div>
            <div class="col-sm-9">
                <textarea class="form-control" id="summary"></textarea>
            </div>
        </div>


            <div class="form-group">
                <label class="col-sm-2 control-label col-md-push-1" for="editor">描述</label>
                <div class="col-sm-10">
                    <textarea name="content" id="editor"  style="width:800px;height:500px;"></textarea>
                    <script>
                        var ue = UE.getEditor('editor');
                    </script>
                </div>
            </div>

        <div class="form-group">
            <label for="create_at" class="col-md-2  control-label col-md-push-1">创建时间</label>
            <div class="col-md-9">
            <input class="form-control" name="create_at" placeholder="创建时间" id="create_at">
            </div>
        </div>
        <input type="submit" class="btn btn-success col-md-2 col-md-offset-2" >
    </div>

    </form>
</block>

<block name="js">
    <script type="text/javascript"   src="__PUBLIC__/ueditor/ueditor.config.js"></script>
    <script type="text/javascript"    src="__PUBLIC__/ueditor/ueditor.all.min.js"></script>
    <script type="text/javascript"    src="__PUBLIC__/ueditor/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript"    src="__PUBLIC__/uploadify/jquery.uploadify.min.js"></script>


    <script type="text/javascript">
        $(function() {
            $('#file').uploadify({
                'formData'     : {
                    '<?php echo session_name();?>' : '<?php echo session_id();?>',
                },
                'fileTypeDesc' : 'مەھسۇلات رەسىملىرى',//上传描述
                'fileTypeExts' : '*.jpg;*.png',
                'swf'      : '__PUBLIC__/uploadify/uploadify.swf',
                'uploader' : '__ROOT__/Admin/Content/up',
                'buttonText':'封面',
                'fileSizeLimit' : '2000KB',
                'uploadLimit' : 10,//上传文件数
                'width':200,
                'height':40,
                'successTimeout':10,//等待服务器响应时间
                'removeTimeout' : 0.2,//成功显示时间
                'onUploadSuccess' : function(file, data, response) {
                    data=$.parseJSON(data);
                    //获得图片地址
                    var li="<li><img src='__ROOT__/"+data+"'/> <input type='hidden' name='cover[]' value='"+data+"'/> </li>";
                    $(".article_thumb").prepend(li);

                }
            });
        });
    </script>
    <!--<script type="text/javascript"  charset="utf-8"  src="__PUBLIC__/js/bootstrap-datetimepicker.min.js"></script>-->
    <!--<script>
        $(function(){
            $('#create_at').datetimepicker({
                pickDate: true,
                pickTime: false,
                format: 'YYYY-MM-DD',
            });
        });
    </script>-->
</block>
<block name="css">
    <link type="text/css" href="__PUBLIC_/css/bootstrap-datetimepicker.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/uploadify/uploadify.css">
</block>
